package ezCall;

import java.util.Vector;
import net.rim.device.api.system.PersistentContent;
import net.rim.device.api.util.Persistable;


final class Option_Model implements Persistable
{
    // Data
    private Vector _fields;
    private Vector _fields_Str;

	boolean  _ClearText_AfterCall;
	boolean  _Photo_View;
	boolean  _Space_BetweenLastFirstName;
	int      _Order_NameView;
	
	int      _Find_SubMode;
	
	int      _AutoStart;
    
	int      _DefaultInputMode;
	
	boolean  _Support_9100_Model;
	
	
    // Fields
    public static final int MAIN_SCREEN_CLICK_FUNC  = 0;
    public static final int MAIN_SCREEN_ENTER_FUNC  = 1;
    public static final int PHONE_SCREEN_CLICK_FUNC = 2;
    public static final int PHONE_SCREEN_ENTER_FUNC = 3;
    public static final int PHOTO_VIEW = 4;
    
    public static final int CALL  = 0;
    public static final int SMS   = 1;
    public static final int EMAIL = 2;
    public static final int MMS   = 3;
    
    public static final int NUM_FIELDS = 5;  // Change this if any fields are added/removed.

    
    public static final int FIND_SUBMODE_NAME_COMPANY  = 0;
    public static final int FIND_SUBMODE_NAME_FIRST    = 1;
    public static final int FIND_SUBMODE_COMPANY_FIRST = 2;
    
    public static final int NAME_VIEW_LAST_NAME_FIRST  = 0;
    public static final int NAME_VIEW_FIRST_NAME_FIRST = 1;
    
    public static final int AUTO_START_YES = 1;
    public static final int AUTO_START_NO  = 0;
    
    public static final int  DEFAULT_INPUT_MODE_KOREAN  = 0;
    public static final int  DEFAULT_INPUT_MODE_ENGLISH = 1;
    public static final int  DEFAULT_INPUT_MODE_NONE    = 2;
    
    public static final boolean  NO_SUPPORT = false;
    public static final boolean  SUPPORT    = true;
    
    public Option_Model()
    {
    	String MAIN_SCREEN_CLICK_FUNC_OptionString[] = {"CALL", "SMS", "E-Mail"};
    	String MAIN_SCREEN_ENTER_FUNC_OptionString[] = {"CALL", "SMS", "E-Mail"};
    	String PHONE_SCREEN_CLICK_FUNC_OptionString[] = {"CALL", "SMS"};
    	String PHONE_SCREEN_ENTER_FUNC_OptionString[] = {"CALL", "SMS"};
    	
    	
        _fields = new Vector( NUM_FIELDS ); // Set initial capacity.
        _fields_Str = new Vector( NUM_FIELDS ); // Set initial capacity.
        
        _fields.addElement("E-Mail");  // MAIN_SCREEN_CLICK_FUNC                
        _fields_Str.addElement(MAIN_SCREEN_CLICK_FUNC_OptionString );

        
        _fields.addElement("SMS");     // MAIN_SCREEN_ENTER_FUNC
        _fields_Str.addElement(MAIN_SCREEN_ENTER_FUNC_OptionString );
        
        
        
        _fields.addElement("CALL");     // PHONE_SCREEN_CLICK_FUNC
        _fields_Str.addElement(PHONE_SCREEN_CLICK_FUNC_OptionString );
        
        _fields.addElement("SMS");     // PHONE_SCREEN_ENTER_FUNC
        _fields_Str.addElement(PHONE_SCREEN_ENTER_FUNC_OptionString );
        
        _fields.addElement("");
        
        
        _ClearText_AfterCall = false;
        _Photo_View = true;
        _Space_BetweenLastFirstName = false;
        
        _Order_NameView = NAME_VIEW_LAST_NAME_FIRST;
        
        _Find_SubMode = FIND_SUBMODE_NAME_COMPANY;
        
        _AutoStart = AUTO_START_NO;
        
        _DefaultInputMode = DEFAULT_INPUT_MODE_KOREAN;
        
        _Support_9100_Model = NO_SUPPORT;
    }


    public String Get_Field(int id)
    {
        return  (String)_fields.elementAt( id );
    }

    public String[] Get_FuncStr( int FieldIndex )
    {
    	String OptionString[] = (String[])_fields_Str.elementAt( FieldIndex );
    	
    	return OptionString;
    }

 

    
    public int Get_SelectedStrIndex( int FieldIndex )
    {
    	String OptionString[] = Get_FuncStr( FieldIndex);
    	
    	int SelectedIndex = 0;
    	
    	for( int i=0; i<OptionString.length; i++ )
    	{
    		String Str = (String)_fields.elementAt(FieldIndex);
    		int Index = OptionString[i].indexOf( Str );
    		if( Index >= 0 )
    		{
    			SelectedIndex = i;
    		}
    	}

    	
    	return SelectedIndex;
    }
    
    
    public void Set_Field(int id, String value)
    {
        _fields.setElementAt( value, id );
    }
    
    
    public void Set_ClearText_AfterCall( boolean bData )
    {
    	_ClearText_AfterCall = bData;
    }
    
    public boolean Get_ClearText_AfterCall()
    {
    	return _ClearText_AfterCall;
    }  
    
    
    public void Set_Photo_View( boolean bData )
    {
    	_Photo_View = bData;
    }
    
    public boolean Get_Photo_View()
    {
    	return _Photo_View;
    }  
    
    
    public void Set_Space_BetweenLastFirstName( boolean bData )
    {
    	_Space_BetweenLastFirstName = bData;
    }
    
    public boolean Get_Space_BetweenLastFirstName()
    {
    	return _Space_BetweenLastFirstName;
    }     
    
    
    
    public void Set_Find_SubMode( int iData )
    {
    	_Find_SubMode = iData;
    }
    
    public int Get_Find_SubMode()
    {
    	return _Find_SubMode;
    }     
    
    
    public void Set_Order_NameView( int iData )
    {
    	_Order_NameView = iData;
    }
    
    public int Get_Order_NameView()
    {
    	return _Order_NameView;
    }   
    
    public void Set_AutoStart( int iData )
    {
    	_AutoStart = iData;
    }
    
    public int Get_AutoStart()
    {
    	return _AutoStart;
    }
    
    public void Set_DefaultInputMode( int iData )
    {
    	_DefaultInputMode = iData;
    }
    
    public int Get_DefaultInputMode()
    {
    	return _DefaultInputMode;
    }      
    
    public void Set_Support9100( boolean bData )
    {
    	_Support_9100_Model = bData;
    }
    
    public boolean Get_Support9100()
    {
    	return _Support_9100_Model;
    }       
}
